<template>
	<view class="content">
		<view class="phoneContent">
			<view class="name">交易所帐户</view>
			<input placeholder="请输入交易所帐户" placeholder-class="placeholder" class="input" v-model="id" />
		</view>

		<view class="loginContent" :class="id ?'loginContentSubmit':''" @tap="submit">确定</view>
	</view>
</template>

<script>
	import {
		getExchangeAccount,
		bindExchangeAccount
	} from '@/api/api.js'
	export default {
		data() {
			return {
				id: '',
			}
		},
		onShow() {
			this.getCount()
		},
		methods: {
			getCount() {
				getExchangeAccount().then(res => {
					this.id = res.data.account
				})
			},
			submit() {

				if (!this.id) {
					uni.showToast({
						icon: 'none',
						title: '请输入交易帐户'
					})
					return false
				}
				let data = {
					account: this.id,
				}
				bindExchangeAccount(data).then(res => {
					uni.showToast({
						icon: 'none',
						title: '绑定成功'
					})
					uni.switchTab({
						url:'/pages/mine/index'
					})
				})
			}
		}
	}
</script>

<style>
	page {
		background-color: #F6F6F8;
	}
</style>
<style lang="less" scoped>
	.content {
		display: flex;
		align-items: center;
		flex-direction: column;

		// 手机号
		.phoneContent {
			margin-top: 20rpx;
			background-color: #fff;
			position: relative;
			width: 662rpx;
			padding: 28rpx 20rpx 16rpx 28rpx;

			.name {
				font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
				font-weight: 400;
				font-size: 28rpx;
				color: #000000;
				line-height: 36rpx;
			}

			.placeholder {
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 26rpx;
				color: #BCBDBD;
				line-height: 26rpx;
			}

			.input {
				margin-top: 24rpx;
				height: 56rpx;
				width: 100%;
				border-bottom: 1rpx solid rgba(249, 249, 249, 1);
			}

			.codeContent {
				position: absolute;
				right: 40rpx;
				bottom: 20rpx;
				font-size: 26rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: rgba(83, 167, 0, 1);
				line-height: 37rpx;
			}
		}

		.loginContent {
			width: 670rpx;
			height: 88rpx;
			background-color: rgba(225, 225, 225, 1);
			border-radius: 45rpx;
			font-size: 28rpx;
			font-family: PingFangSC-Medium, PingFang SC;
			font-weight: 500;
			color: #FFFFFF;
			line-height: 88rpx;
			text-align: center;
			margin-top: 60rpx;
		}

		.loginContentSubmit {
			background-color: rgba(83, 167, 0, 1);
		}
	}
</style>